package com.earthea.common.exception;

/**
 * earthea公共异常
 */
public class EartheaCheckedException extends Exception implements IErrorCode {
    private IErrorCode errorCode;

    public EartheaCheckedException() {
        this.errorCode = ErrorCodeEnum.FAIL;
    }

    public EartheaCheckedException(IErrorCode errorCode) {
        this.errorCode = errorCode;
    }

    public EartheaCheckedException(Throwable cause) {
        super(cause);
    }

    public EartheaCheckedException(IErrorCode errorCode, Throwable cause) {
        super(cause);
        this.errorCode = errorCode;
    }

    @Override
    public int getCode() {
        return errorCode.getCode();
    }

    @Override
    public String getMsg() {
        return errorCode.getMsg();
    }
}
